/*
 * @Date: 2024-04-01 09:33:35
 * @LastEditors: bingkui.wu
 * @LastEditTime: 2024-04-07 09:34:21
 * @Description: 用户信息
 */
import mongoose, { Schema, Model, Document } from 'mongoose';

export interface IWord {
    wordId: string,
    eng: string,
    result: string
}

export interface IUser extends Document {
    userName: string,
    password: string,
    nickName: string,
    createTime: number,
    starCount: number,
    correctWords: IWord[],
    incorrectWords: IWord[]
}

export interface IUserModel extends Model<IUser> {
}

const schema = new Schema({
    userName: String,
    password: String,
    nickName: String,
    createTime: Number,
    starCount: Number,
    correctWords: Object,
    incorrectWords: Object,
});

export const User = mongoose.model<IUser>('user', schema) as IUserModel;
